package net.da.processor;

import com.google.inject.Inject;

import net.da.DaStarter;
import net.da.processor.authorization.LoginProcessor;
import net.da.processor.authorization.LogoutProcessor;
import net.da.processor.user.CreateUserProcessor;
import net.da.processor.user.DeleteUserProcessor;
import net.da.processor.user.ReadUsersListProcessor;
import net.da.processor.user.UpdateUserProcessor;

public class ProcessorProvider {

    @Inject
    private LoginProcessor loginProcessor;

//    @Inject
//    private LogoutProcessor logoutProcessor;

//    @Inject
//    private CreateUserProcessor createUserProcessor;
//
//    @Inject
//    private DeleteUserProcessor deleteUserProcessor;
//
//    @Inject
//    private ReadUsersListProcessor usersListProcessor;
//
//    @Inject
//    private UpdateUserProcessor updateUserProcessor;
//
//    public CreateUserProcessor getCreateUserProcessor() {
//        return createUserProcessor;
//    }
//
//    public void setCreateUserProcessor(CreateUserProcessor createUserProcessorImpl) {
//        this.createUserProcessor = createUserProcessorImpl;
//    }
//
//    public DeleteUserProcessor getDeleteUserProcessor() {
//        return deleteUserProcessor;
//    }
//
//    public void setDeleteUserProcessor(DeleteUserProcessor deleteUserProcessorImpl) {
//        this.deleteUserProcessor = deleteUserProcessorImpl;
//    }

    public LoginProcessor getLoginProcessor() {
        return loginProcessor;
    }

    public void setLoginProcessor(LoginProcessor loginProcessorImpl) {
        this.loginProcessor = loginProcessorImpl;
    }

//    public LogoutProcessor getLogoutProcessor() {
//        return logoutProcessor;
//    }
//
//    public void setLogoutProcessor(LogoutProcessor logoutProcessorImpl) {
//        this.logoutProcessor = logoutProcessorImpl;
//    }
//
//    public UpdateUserProcessor getUpdateUserProcessor() {
//        return updateUserProcessor;
//    }
//
//    public void setUpdateUserProcessor(UpdateUserProcessor updateUserProcessorImpl) {
//        this.updateUserProcessor = updateUserProcessorImpl;
//    }
//
//    public ReadUsersListProcessor getUsersListProcessor() {
//        return usersListProcessor;
//    }
//
//    public void setUsersListProcessor(ReadUsersListProcessor usersListProcessor) {
//        this.usersListProcessor = usersListProcessor;
//    }


// =========================== SERVICE METHODS =========================== //

    private static ProcessorProvider processorProvider;

    private ProcessorProvider() {
    }

    public static ProcessorProvider getInstance(boolean testMode) {
        if (processorProvider == null) {
            processorProvider = new ProcessorProvider();
            if (testMode) {
                DaStarter.getInjector().injectMembers(processorProvider);
            } else {
                DaStarter.getInjector().injectMembers(processorProvider);
            }

        }
        return processorProvider;
    }

}
